-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show Room name in Desktop notification title if message is come from a chat room #19053
Conversation
@Julesssss @s77rt One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screenshots look good to me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, just a very minor suggestion
let title = ''; | ||
let body = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let title = ''; | |
let body = ''; | |
let title; | |
let body; |
NAB. No need to set a init value here.
const {person, message} = reportAction; | ||
const plainTextPerson = _.map(person, (f) => f.text).join(); | ||
const isChatRoom = ReportUtils.isChatRoom(report); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB. Can you move this line to look like this just for clarity
const isChatRoom = ReportUtils.isChatRoom(report);
let title;
let body;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a good idea if I move them to top? Basically, intepreter usually move declaration to the top too.
let title;
let body;
const isChatRoom = ReportUtils.isChatRoom(report);
const {person, message} = reportAction;
const plainTextPerson = _.map(person, (f) => f.text).join();
// Specifically target the comment part of the message
const plainTextMessage = (_.find(message, (f) => f.type === 'COMMENT') || {}).text;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes looks good. but add an empty line after isChatRoom and before the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushReportCommentNotification({report, reportAction, onClick}, usesIcon = false) {
let title;
let body;
const isChatRoom = ReportUtils.isChatRoom(report);
const {person, message} = reportAction;
const plainTextPerson = _.map(person, (f) => f.text).join();
// Specifically target the comment part of the message
const plainTextMessage = (_.find(message, (f) => f.type === 'COMMENT') || {}).text;
if (isChatRoom) {
const roomName = _.get(report, 'displayName', '');
title = roomName;
body = `${plainTextPerson}: ${plainTextMessage}`;
} else {
title = plainTextPerson;
body = plainTextMessage;
}
push({
title,
body,
delay: 0,
onClick,
icon: usesIcon ? EXPENSIFY_ICON_URL : '',
});
},
Just wanna clarify 1 more question. Do you think it too much empty line in this function? Or it looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated PR with our discussion above. Could you help to review them again? Thanks
Reviewer Checklist
Screenshots/VideosMobile Web - ChromeMobile Web - SafariiOSAndroid |
Lint should have failed as we have no empty line before this comment . Something is wrong with the linter. |
Does it mean we should an empty line before a comment? |
AFAIK Yes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀 Thank you @hoangzinh
cc @Julesssss
🚀 Deployed to staging by https://github.com/Julesssss in version: 1.3.16-2 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
2 similar comments
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
const {person, message} = reportAction; | ||
const plainTextPerson = _.map(person, (f) => f.text).join(); | ||
|
||
// Specifically target the comment part of the message | ||
const plainTextMessage = (_.find(message, (f) => f.type === 'COMMENT') || {}).text; | ||
|
||
if (isChatRoom) { | ||
const roomName = _.get(report, 'displayName', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be reportName
? Because I can't see the displayName
property. I was working on this PR #28200 (comment) and realized that the notifications for chat rooms might be broken for web and desktop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a regression from #21406 #21406 (comment). This should be changed to:
const roomName = ReportUtils.getReportName(report);
But if reportName
prop already exists we can use it directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, great, thanks for the context. I will update it to use getReportName
.
Details
Fixed Issues
$ #16583
PROPOSAL: #16583 (comment)
Tests
On Web/Desktop:
Offline tests
This feature can't test when offline
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Notification from a chat room
Notification from a normal chat
Mobile Web - Chrome
N/A
Mobile Web - Safari
N/A
Desktop
Notification from a chat room
Notification from a normal chat
iOS
N/A
Android
N/A